package com.tyut.service.impl;

import com.tyut.bean.Student;
import com.tyut.dao.StudentDao;
import com.tyut.service.StudentService;

import java.util.List;

public class StudentServiceImpl implements StudentService {
    private StudentDao studentDao = new StudentDao();
    @Override
    public int add(Student student) {
        Student query = studentDao.query(student.getId());
        if (query == null){
            return 0;
        }
        return studentDao.add(student);
    }

    @Override
    public int delete(Integer id) {
        return studentDao.delete(id);
    }

    @Override
    public int update(Student student) {
        return 0;
    }

    @Override
    public Student query(Integer id) {
        return studentDao.query(id);
    }

    @Override
    public List<Student> queryAll() {
        return studentDao.queryAll();
    }
}
